using System;
using System.Collections.Generic;
using System.Text;

namespace Hermes.Framework.Implementation.File
{
    public class TxFileRename : TxOperationTemplate, ITransactableRename
    {
        public TxFileRename(string fileName)
            :
            base(fileName)
        {
        }

        protected override void Operate()
        {
            //this.fileSystem.Rename(this.dstFileName, this.dstFileName + ".shadow");
        }

        public override void Commit()
        {
            this.fileSystem.Rename(this.srcFileName, this.dstFileName);
        }

        public override void Rollback()
        {
            // do nothing
        }

        #region ITransactableRename Members

        public void Rename()
        {
            base.Execute(base.srcFileName, base.dstFileName);
        }

        #endregion
    }
}
